<%@ page language="java" contentType="text/html; charset=UTF-8"
	import="java.util.*" pageEncoding="UTF-8"%>



<%@ include file="../../../common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<sfa:mainTitle></sfa:mainTitle>
		<%@ include file="../../../common/meta.jsp"%>
		<script type="text/javascript">
var EX = {
	addEvent : function(k, v) {
		var me = this;
		if (me.addEventListener)
			me.addEventListener(k, v, false);
		else if (me.attachEvent)
			me.attachEvent("on" + k, v);
		else
			me["on" + k] = v;
	},
	removeEvent : function(k, v) {

		var me = this;
		if (me.removeEventListener)
			me.removeEventListener(k, v, false);
		else if (me.detachEvent)
			me.detachEvent("on" + k, v);
		else
			me["on" + k] = null;
	},
	stop : function(evt) {
		evt = evt || window.event;
		evt.stopPropagation ? evt.stopPropagation() : evt.cancelBubble = true;
	}
};
var url = '#';
function show() {
	var o = document.getElementById('pop');
	o.style.display = "";
	setTimeout(function() {
		EX.addEvent.call(document, 'click', hide);
	});
}
function hide() {
	var o = document.getElementById('pop');
	o.style.display = "none";
	var t = document.getElementById('pops');
	t.style.display = "none";
	EX.removeEvent.call(document, 'click', hide);

}
function showsuccees() {
	var o = document.getElementById('pops');
	o.style.display = "";
	setTimeout(function() {
		EX.addEvent.call(document, 'click', hide);
	});
}

$(function() {
	$("#submit").click(function() {
		var data = {
			succeedStr : "${succeedStr}",
			validdatetime : "${validdatetime}",
		};
		
		var succeedCount = ${succeedSize};
		if(succeedCount==0){
			art.dialog( {
			icon : "error",
			content : "成功的至少一条!",
			lock : true,
			ok : true
		});
		}else{
		$.ajax( {
			type : 'post',
			data : data,
			url : '${path}/sms/index/add',
			success : function(data) {
				//window.location.href = "${path}/manage/message/index";
			$("#step3").show();
			$("#body").hide();
		}
		});
	}	
	});
});
</script>
		<style type="text/css">
.pop {
	position: absolute;
	left: 29.5%;
	top: 30%;
	width: 700px;
	height: auto;
	background: #eee;
	border: 1px solid #ccc
}

.pop_head {
	position: relative;
	height: 20px;
	background: #ccc
}

.pop_head a {
	position: absolute;
	right: 8px;
	line-height: 20px;
	color: #000;
	text-decoration: none
}

.pop_head a:hover {
	color: #f60;
	text-decoration: none
}

.pop_body {
	padding: 8px
}
</style>
		<link rel="stylesheet" type="text/css"
			href="${path}/css/addnews/step1.css" id="step">
		<link rel="stylesheet" type="text/css" href="${path}/css/step/an.css">
	</head>
	<body id="master">
		<sfa:mainHeader></sfa:mainHeader>
		<div class="webpart3 contentarea">
			<div class="webpart-head">
				<div class="webpart-head-item">
					校验结果
				</div>
			</div>
			<div class="webpart-main">
				<div class="webpart-main-item" style="padding-top: 12px;">
					<div id="body">
						<div class="at_loc">
							<span style="width: 208px;" id="firstStep">输入发送信息</span>
							<span class="line_last" id="firstStep_line"></span>
							<span class="now" style="width: 208px;" id="secondStep">结果校验</span>
							<span class="line_frist" id="secondStep_line"></span>
							<span style="width: 208px;" id="thirdStep">发送成功</span>
							<span class="line_end" id="thirdStep_line"></span>
						</div>

						<table width="667" border="0" cellspacing="0" cellpadding="10"
							class="form_table">
							<tr>
								<td>
									校验通过的前五条：
								</td>
							</tr>
							<tr>
								<td>
									<table cellpadding="0" cellspacing="0"
										class="dg_borderstyle trStyleTable" style="margin-top: 15px;">
										<tr>
											<th>
												收件人
											</th>
											<th>
												手机号码
											</th>
											<th>
												发送内容
											</th>
										</tr>
										<c:forEach items="${succeedDime}" var="succeed" begin="0"
											end="4">
											<tr>
												<c:forEach items="${succeed}" var="data">
													<td align="center">
														${data}
													</td>
												</c:forEach>
											</tr>
										</c:forEach>
									</table>
								</td>
							</tr>
							<c:if test="${succeedSize >  5}">
								<tr>
									<td>
										校验通过的后五条：
								</tr>
								<tr>
									<td>
										<table cellpadding="0" cellspacing="0"
											class="dg_borderstyle trStyleTable" style="margin-top: 15px;">
											<tr>
												<th>
													收件人
												</th>
												<th>
													手机号码
												</th>
												<th>
													发送内容
												</th>
											</tr>
											<c:forEach items="${succeedDime}" var="succeed"
												begin="${lastBegin}" end="${lastEnd}">
												<tr>
													<c:forEach items="${succeed}" var="data">
														<td align="center">
															${data}
														</td>
													</c:forEach>
												</tr>
											</c:forEach>
										</table>
									</td>
								</tr>
							</c:if>
							<tr>
								<td>
									校验不符合规则的:
									<c:if test="${failSize != 0}">
										<font color="red"> <a href="javascript:void(0);"
											onclick="show()">${failSize}</a> </font>
									</c:if>
									<c:if test="${failSize == 0}">
										<font color="red"> 0</font>
									</c:if>
									条
								</td>
							</tr>
							<tr>
								<td>
									总计符合规则的:

									<c:if test="${succeedSize != 0}">
										<font id="succeedsize"><a href="javascript:void(0);"
											onclick="showsuccees()"> ${succeedSize} </a> </font>
									</c:if>
									<c:if test="${succeedSize == 0}">
										<font> 0</font>
									</c:if>
									条
								</td>
							</tr>
							<tr>

							</tr>
						</table>

						<input type="button" class="linkbtn2" onclick="history.go(-1);"
							value="上一步" />
						<input id="submit" type="button" class="linkbtn2" value="提交" />
					</div>
					<!-- ---- 成功之后------ -->
					<div id="step3" style="display: none;">
						<div class="at_loc">
							<span style="width: 208px;" id="firstStep">输入发送信息</span>
							<span class="line" id="firstStep_line"></span>
							<span style="width: 208px;" id="secondStep">结果校验</span>
							<span class="line_last" id="secondStep_line"></span>
							<span class="now" style="width: 208px;" id="thirdStep">发送成功</span>
							<span class="line_over" id="thirdStep_line"></span>
						</div>
						<div style="margin-top: 15px;">
							<a href="${path}/sms/index/send"><font color="red">继续发送</font>
							</a> |
							<a href="${path}/sms/index"><font color="red">跳到管理页面
							</font>
						</div>
					</div>
				</div>
				<div class="webpart-foot">
					<div class="webpart-foot-item">
					</div>
				</div>
			</div>

			<!-- 弹出层内容  -->
			<div id="pop" class="pop" style="display: none">
				<div class="pop_head">
					<div class="webpart-head">
						<div class="webpart-head-item">
							不符合规则的条目
							<div class="tools-btn">
								<a href="javascript:void(0);" onclick="hide()">关闭</a>
							</div>
						</div>
					</div>
				</div>
				<div class="pop_body">
					<table cellpadding="0" cellspacing="0"
						class="dg_borderstyle trStyleTable" style="margin-top: 15px;">
						<tr>
							<th>
								收件人
							</th>
							<th>
								手机号码
							</th>
							<th>
								发送内容
							</th>
						</tr>
						<c:forEach items="${failDime}" var="fail">
							<tr>
								<c:forEach items="${fail}" var="data">
									<td align="center">
										${data}
									</td>
								</c:forEach>
							</tr>
						</c:forEach>
					</table>

				</div>

			</div>

			<!--符合规则的条目  -->


			<div id="pops" class="pop" style="display: none">
				<div class="pop_head">
					<div class="webpart-head">
						<div class="webpart-head-item">
							符合规则的条目
							<div class="tools-btn">
								<a href="javascript:void(0);" onclick="hide()">关闭</a>
							</div>
						</div>
					</div>
				</div>
				<div class="pop_body">
					<table cellpadding="0" cellspacing="0"
						class="dg_borderstyle trStyleTable" style="margin-top: 15px;">
						<tr>
							<th>
								收件人
							</th>
							<th>
								手机号码
							</th>
							<th>
								发送内容
							</th>
						</tr>
						<c:forEach items="${succeedDime}" var="succeed">
							<tr>
								<c:forEach items="${succeed}" var="data">
									<td align="center">
										${data}
									</td>
								</c:forEach>
							</tr>
						</c:forEach>
					</table>
				</div>
			</div>


		</div>
		<sfa:mainFooter></sfa:mainFooter>
	</body>
</html>

